<template>
  <div class="cart">
    <nav-bar class="nav-bar">
      <div slot="center">购物车({{ length }})</div>
    </nav-bar>
    <cart-list></cart-list>
  </div>
</template>

<script>
import NavBar from "../../components/common/navbar/NavBar.vue";
import { mapGetters } from "vuex";
import CartList from "./childComponents/CartList.vue";

export default {
  name: "Cart",
  components: { NavBar, CartList },
  computed: {
    // cartLength(){
    //   return this.$store.getters.cartLength
    // }
    // ...mapGetters(['cartLength'])
    ...mapGetters({
      length: "cartLength",
    }),
  },
};
</script>

<style scoped>
.nav-bar {
  background-color: pink;
  font-weight: 400;
  z-index: 10;
}
.cart{
  height: 100vh;
}
</style>